home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
051-060
/
amok58
/
realconversions2
/
rctest.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
1KB
|
44 lines
MODULE RCTest; (* Test of module RealConversions2 *)
IMPORT io,
RC:RealConversions2;
VAR
r:REAL;
ges,nach:LONGINT;
expo,left:BOOLEAN;
string:ARRAY 20 OF CHAR;
c:ARRAY 2 OF CHAR;
BEGIN
io.WriteString('Test of the procedures StringToReal() and RealToString()\n');
io.WriteString('The input-string is converted to a real-number and then\n');
io.WriteString('converted back to a string. Enter 0 to exit!\n\n');
io.WriteString('Scientific Notation (Y/N) ? ');
io.ReadString(c);
expo:=(CAP(c[0])='J') OR (CAP(c[0])='Y');
io.WriteString('Left justified? ');
io.ReadString(c);
left:=(CAP(c[0])='J') OR (CAP(c[0])='Y');
io.WriteString('Number of significant digits: ');
IF io.ReadInt(ges) THEN END;
io.WriteString('Digits behind the decimalpoint: ');
IF io.ReadInt(nach) THEN END;
REPEAT
io.WriteString('Input :');
io.ReadString(string);
io.WriteString('Output:');
RC.DeleteSpaces(string);
IF NOT RC.StringToReal(string,r) THEN
io.WriteString('Input-Error ')
END;
IF NOT RC.RealToString(r,string,SHORT(ges),SHORT(nach),expo,left) THEN
io.WriteString('String (20) is too small for this number ')
END;
io.WriteString(string);
io.WriteLn;
UNTIL r=0;
io.WriteLn;
END RCTest.